/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Pruebas;

import junit.framework.TestCase;
import org.junit.*;
import static org.junit.Assert.*;
import net.sourceforge.jwebunit.exception.ExpectedJavascriptAlertException;
import net.sourceforge.jwebunit.junit.WebTester;
    
/**  
 *
 * @author Administrador
 */
public class Prueba1 extends TestCase
{
    private WebTester tester;
    

    public Prueba1(String arg0) 
    {
        super(arg0);
        tester = new WebTester();
        tester.getTestContext().setBaseUrl
        ("http://localhost:8080/otro");
    }
    
    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }
    
    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }
    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
    // @Test 
    // public void hello() {}
    public void testPaginaInicio() 
    {
        tester.beginAt("/index.");
        tester.assertButtonPresent("inicio:submit");
        tester.assertFormElementPresent("inicio:username");
        tester.setTextField("inicio:username", "usuario");
        tester.assertFormElementPresent("inicio:password");
        tester.setTextField("inicio:password", "sesamo");
        tester.clickButton("inicio:submit");
        //navegamos a la página principal
        tester.assertTextPresent("Bienvenido, usuario");
}
}
